package co.yixiang.yshop.module.product.dal.mysql.storeproductassureref;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.module.product.controller.admin.storeproductassureref.vo.StoreProductAssureRefExportReqVO;
import co.yixiang.yshop.module.product.controller.admin.storeproductassureref.vo.StoreProductAssureRefPageReqVO;
import co.yixiang.yshop.module.product.dal.dataobject.storeproductassureref.StoreProductAssureRefDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 商品保障服务关联 Mapper
 *
 * @author admin
 */
@Mapper
public interface StoreProductAssureRefMapper extends BaseMapperX
        <StoreProductAssureRefDO> {

    default PageResult<StoreProductAssureRefDO> selectPage(StoreProductAssureRefPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX
                <StoreProductAssureRefDO>()
                .eqIfPresent(StoreProductAssureRefDO::getProductId, reqVO.getProductId())
                .eqIfPresent(StoreProductAssureRefDO::getAssureId, reqVO.getAssureId())
                .orderByDesc(StoreProductAssureRefDO::getId));
    }

    default List<StoreProductAssureRefDO> selectList(StoreProductAssureRefExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX
                <StoreProductAssureRefDO>()
                .eqIfPresent(StoreProductAssureRefDO::getProductId, reqVO.getProductId())
                .eqIfPresent(StoreProductAssureRefDO::getAssureId, reqVO.getAssureId())
                .orderByDesc(StoreProductAssureRefDO::getId));
    }

}
